#pragma once

#include <QObject>
#include <QSettings>

namespace MISystem
{
    class SettingsManager : public QObject
    {
        Q_OBJECT
    public:
        static SettingsManager& instance();

        int lackRemindThreshold() const;
        int stockWarningThreshold() const;
        QString systemStatus() const;
        QString operatorName() const;

        void setLackRemindThreshold(int num);
        void setStockWarningThreshold(int num);
        void setSystemStatus(const QString& text);
        void setOperatorName(const QString& text);

        void saveSettings();
        void loadSettings();

    private:
        SettingsManager(QObject* parent = nullptr);
        ~SettingsManager();

        SettingsManager(const SettingsManager&) = delete;
        SettingsManager& operator=(const SettingsManager&) = delete;

        QSettings* _settings;

        int _lackRemindThreshold;
        int _stockWarningThreshold;
        QString _systemStatus;
        QString _operatorName;
    };

}